// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.7
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

// EpBannerUpdateFields 修改轮播图字段过滤
type EpBannerUpdateFields struct {
	Title       string `json:"title"       dc:"标题"`
	Linkurl     string `json:"linkurl"     dc:"链接地址"`
	Bannerimage string `json:"bannerimage" dc:"图片"`
	Sort        int    `json:"sort"        dc:"排序"`
	State       int    `json:"state"       dc:"状态"`
}

// EpBannerInsertFields 新增轮播图字段过滤
type EpBannerInsertFields struct {
	Title       string `json:"title"       dc:"标题"`
	Linkurl     string `json:"linkurl"     dc:"链接地址"`
	Bannerimage string `json:"bannerimage" dc:"图片"`
	Sort        int    `json:"sort"        dc:"排序"`
	State       int    `json:"state"       dc:"状态"`
}

// EpBannerEditInp 修改/新增轮播图
type EpBannerEditInp struct {
	entity.EpBanner
}

func (in *EpBannerEditInp) Filter(ctx context.Context) (err error) {
	// 验证标题
	if err := g.Validator().Rules("required").Data(in.Title).Messages("标题不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证排序
	if err := g.Validator().Rules("required").Data(in.Sort).Messages("排序不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type EpBannerEditModel struct{}

// EpBannerDeleteInp 删除轮播图
type EpBannerDeleteInp struct {
	Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}

func (in *EpBannerDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type EpBannerDeleteModel struct{}

// EpBannerViewInp 获取指定轮播图信息
type EpBannerViewInp struct {
	Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}

func (in *EpBannerViewInp) Filter(ctx context.Context) (err error) {
	return
}

type EpBannerViewModel struct {
	entity.EpBanner
}

// EpBannerListInp 获取轮播图列表
type EpBannerListInp struct {
	form.PageReq
}

func (in *EpBannerListInp) Filter(ctx context.Context) (err error) {
	return
}

type EpBannerListModel struct {
	Id          int64       `json:"id"          dc:"ID"`
	Title       string      `json:"title"       dc:"标题"`
	Linkurl     string      `json:"linkurl"     dc:"链接地址"`
	Bannerimage string      `json:"bannerimage" dc:"图片"`
	Sort        int         `json:"sort"        dc:"排序"`
	State       int         `json:"state"       dc:"状态"`
	CreatedAt   *gtime.Time `json:"createdAt"   dc:"创建日期"`
	UpdatedAt   *gtime.Time `json:"updatedAt"   dc:"更新时间"`
}

// EpBannerExportModel 导出轮播图
type EpBannerExportModel struct {
	Id          int64       `json:"id"          dc:"ID"`
	Title       string      `json:"title"       dc:"标题"`
	Linkurl     string      `json:"linkurl"     dc:"链接地址"`
	Bannerimage string      `json:"bannerimage" dc:"图片"`
	Sort        int         `json:"sort"        dc:"排序"`
	State       int         `json:"state"       dc:"状态"`
	CreatedAt   *gtime.Time `json:"createdAt"   dc:"创建日期"`
	UpdatedAt   *gtime.Time `json:"updatedAt"   dc:"更新时间"`
}

// EpBannerMaxSortInp 获取轮播图最大排序
type EpBannerMaxSortInp struct{}

func (in *EpBannerMaxSortInp) Filter(ctx context.Context) (err error) {
	return
}

type EpBannerMaxSortModel struct {
	Sort int `json:"sort"  description:"排序"`
}

// EpBannerSwitchInp 更新轮播图开关状态
type EpBannerSwitchInp struct {
	form.SwitchReq
	Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}

func (in *EpBannerSwitchInp) Filter(ctx context.Context) (err error) {
	return
}

type EpBannerSwitchModel struct{}